<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
model('jy_scrm/model')->check_custom();
$return=array();
$return['gettype']=array('1'=>'充值兑换','2'=>'活动赠送','3'=>'朋友赠送');
if($_RQ['op']=='get'){
	exi('无权发送红包！','error');
	$return['list']=pdo_getall('jy_weishop_goodscard',array('uniacid'=>$_SESSION['uniacid'],'status'=>1,'gettype'=>1),array('id','ishot','price','money'));
	$return['listgame']=pdo_getall('jy_weishop_goodscard',array('uniacid'=>$_SESSION['uniacid'],'status'=>1,'gettype'=>2),array('id','ishot','price','money'));
	$return['post']['fee']='1.00';
	set_html('title','员工发红包');
	exi($return);
}
if($_RQ['op']=='post'){
	$post=get_postdata();
	$fee=intval($post['fee']);
	if(!$fee){
		exi('请选择红包！','error');
	}
	exi('发送失败！','error');
	$data=array(
		'uniacid'=>$_SESSION['uniacid'],
		'merchid'=>$_SESSION['onemerchid'],
		'mid'=>$_SESSION['uid'],
		'workerid'=>intval($post['id']),
		'userid'=>intval($post['userid']),
		'fee'=>$post['fee'],
		'msg'=>$post['msg'],
		'remark'=>$post['remark'],
		'createtime'=>TIMESTAMP,
	);
	pdo_insert('jy_scrm_worker_redlog',$data);
	exi('发送成功');
}
if($_RQ['op']=='getcard'){
	$post=get_postdata();
	if(!intval($post['id'])){
		exi('请选择购物卡！','error');
	}
	model('jy_scrm/goodscard')->getcard(intval($post['id']),2);
	exi('领取成功！','','jy_weishop/member.mycard/');
}